// run: $exec < input
#include <iostream>
#include <iomanip>

long long a, b;

int main()
{
	std::ios::sync_with_stdio(false);
	std::cin >> a >> b;
	int k1 = (a + b) / (2 * b);
	double a1 = (double)(a + b) / (2.0 * k1);
	int k2 = (a - b) / (2 * b);
	double a2 = (double)(a - b) / (2.0 * k2);
	a2 = std::min(a1, a2);
	if (a2 > 0) {
		std::cout << std::fixed << std::setprecision(10) << a2 << "\n";
	} else
		std::cout << "-1\n";
}

